import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { SIGN_BUSINESS, SIGN_BUSINESS_TEMPLATE, SIGN_BUSINESS_UPDATE } from 'src/app/api/business/e-contract';

@Injectable({
  providedIn: 'root'
})
export class EContractService {

  constructor(
    private http: HttpClient
  ) { }

  _getContractList(pageNumber: number = 1, pageSize: number = 8): Observable<any>{
    return this.http.get(SIGN_BUSINESS, { params: new HttpParams({ fromObject: { pageSize, pageNumber } }) })
  }

  _getContractParams(id: string): Observable<any>{
    return this.http.get(SIGN_BUSINESS_TEMPLATE + id)
  }

  _updateContract(id: string, fileId: string): Observable<any>{
    return this.http.post(SIGN_BUSINESS_UPDATE, { id, fileId })
  }
}
